-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[timeline] fix display of unit above #142
Conversation
… 140-timeline-fix-display-of-unit-above
src/grid/CellGroup/index.tsx
Outdated
dayInfo?: { thisMonth?: number; untilNow?: number; backHour: boolean; forNowHour: boolean }[]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a type for this data structure
src/grid/Cells/index.tsx
Outdated
const dayInfo: { thisMonth?: number; untilNow?: number; backHour: boolean; forNowHour: boolean }[] = []; | ||
if (unitAbove === "month" || unitAbove === "day") { | ||
aboveTimeBlocks.forEach((column, index) => { | ||
const hrs = column.end!.diff(column.start!, "hour").hours; | ||
const month = getMonth(column); | ||
const year = getYear(column); | ||
const currentMonthDays = daysInMonth(Number(month), Number(year)); | ||
const bchour = hrs > 24 ? true : false; | ||
if (index === 0) { | ||
const startDay = getStartMonthsDay(interval.start!); | ||
const daysToMonthEnd = currentMonthDays - Number(startDay) + 1; | ||
dayInfo.push({ thisMonth: daysToMonthEnd, untilNow: daysToMonthEnd, backHour: bchour, forNowHour: false }); | ||
return; | ||
} | ||
const forNowHour = dayInfo[index - 1].forNowHour ? true : dayInfo[index - 1].backHour ? true : false; | ||
const n = dayInfo[index - 1].untilNow! + currentMonthDays; | ||
dayInfo.push({ thisMonth: currentMonthDays, untilNow: n, backHour: bchour, forNowHour: forNowHour }); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use a memo here if possible
src/timeline/TimelineContext.tsx
Outdated
blockEnd = intervalEnd; | ||
} | ||
|
||
logError("Adding Block", `${blockStart.toFormat("dd/MM/yy HH:mm")} > ${blockEnd.toFormat("dd/MM/yy HH:mm")}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove logError
call or switch to logDebug
, or delete
🎉 This PR is included in version 1.16.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR closes #140